package org.nlp.algo.classifier.util;

import java.io.File;
import java.io.FileFilter;
import java.util.ArrayList;
import java.util.List;

public class CorpusProcess {
	public static String[] getCateories(String CorpusPath) {
		File CateoriesDir = new File(CorpusPath);
		String[] Cateories;		
		List<String> catgroies = new ArrayList<String>();

		File[] tranTypes = CateoriesDir.listFiles(new FileFilter() {

			@Override
			public boolean accept(File arg0) {
				if (arg0.getName().startsWith(".")) {
					return false;
				}
				return true;
			}

		});
		for (int i = 0; i < tranTypes.length; i++) {
			if (tranTypes[i].isDirectory()
					&& !tranTypes[i].getName().startsWith(".")) {
				catgroies.add(tranTypes[i].toString().replace(
						tranTypes[i].getParent() + "\\", ""));								
			}
		}

		Cateories = new String[catgroies.size()];
		catgroies.toArray(Cateories);
		return Cateories;
	}
}
